﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace AutoParkingManagement
{
    public partial class LaneExit : UserControl
    {
        #region Constructors
        public LaneExit()
        {
            InitializeComponent();

        }
        #endregion

        #region Private members
        #endregion

        #region Properties
        #endregion

        #region Public members
        public void CaptureImage()
        {
            picFrontOld.Appearance.ImageBackground = Properties.Resources.Front1;
            picRearOld.Appearance.ImageBackground = Properties.Resources.Rear1;
            picFrontNew.Appearance.ImageBackground = picFrontOld.Appearance.ImageBackground;
            picRearNew.Appearance.ImageBackground = picRearOld.Appearance.ImageBackground;
            webCamFront.Visible = !webCamFront.Visible;
            webCamRear.Visible = !webCamRear.Visible;
            picFrontNew.Visible = !webCamFront.Visible;
            picRearNew.Visible = !webCamRear.Visible;
        }

        public void SaveImage()
        {
            picFrontOld.Appearance.ImageBackground = null;
            picRearOld.Appearance.ImageBackground = null;
            picFrontNew.Visible = false;
            picRearNew.Visible = false;
            webCamFront.Visible = !picFrontNew.Visible;
            webCamRear.Visible = !picRearNew.Visible;
        }

        public void ResetLane()
        {
            picFrontOld.Appearance.ImageBackground = null;
            picFrontNew.Appearance.ImageBackground = null;
            picFrontNew.Visible = false;
            picRearOld.Appearance.ImageBackground = null;
            picRearNew.Appearance.ImageBackground = null;
            picRearNew.Visible = false;
            webCamFront.Visible = true;
            webCamRear.Visible = true;
        }
        #endregion

        #region Events
        private void LaneExit_Load(object sender, EventArgs e)
        {
            webCamFront.FileName = String.Format(@"{0}/{1}", Application.StartupPath, "FlickAnimation.avi");
            webCamRear.FileName = webCamFront.FileName;
            webCamFront.Visible = true;
            webCamRear.Visible = true;
            picFrontNew.Visible = !webCamFront.Visible;
            picRearNew.Visible = !webCamRear.Visible;
        }
        #endregion
        
    }
}
